Session4_pres

Lauren

April 9th, 2020

Visualization and Reproducible Reports in R

Session 4

April 9th, 2020

Visualization and Reproducible Reports in R

Presented By:

Lauren Yee is multifaceted researcher and data scientist. She currently works in the consulting industry and designs projects around data visualization, dashboards and ecological and spatial analysis.

Ann Greenwood is the Education and Training Lead for Population Data BC. She manages a variety of education and training services for researchers and population health professionals . Services include an online certificate course in Population Health Data Analysis, live webinar-based courses, free online self -paced workshops, colloquium presentations/webinars and in-person workshops.

Session 4

Interactive Reports

Any HTML format in RMarkdown can add interactivity. HTML is a markup language that gives context and structure to web based content. CSS is the rules and styling of that content.

Most interaction comes from JavaScript libraries that have been translated to R

What is JavaScript?

“JavaScript is a programming language that allows you to implement complex things on web pages. Every time a web page does more than just sit there and display static information for you to look at—displaying timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, or more—you can bet that JavaScript is probably involved.”

(Source: https://developer.mozilla.org/en-US/docs/Learn/JavaScript)

Interactive Reports cont’d

htmlwidgets contains a list of HTML widgets based on JavaScript for R

Not in this workshop:

Data Tables

Add interactive, scrollable, searchable, filterable tables

datatable(head(iris),filter = 'top', class = 'cell-border stripe')

ggplotly

plotly is an R package to create interactive graphics. The main function we will be using is ggplotly in plotly

ggplotly transforms ggplot2 objects into interactive plotly objects powered by JavaScript graphing library plotly.js.

Layouts

Tabsets

Table of Contents

gganimate

gganimate extends ggplot2 to include animation.

transitions are functions that interpret the plot data to distribute it over a number of frames

transition_states() splits up the plot data by a discrete variable and animates between different states

ease_aes() define the velocity for how the aesthetics change during an animation

enter and exit modify how data appearing and exiting the plot are animated

Leaflet

Leaflet is a popular javascript library for interactive maps. It has many features:

Session 4

Contact

Thanks for attending!

Course Materials:



@EcoLaurenY
Research Gate

Sources

https://plotly-r.com/improving-ggplotly.html

https://gganimate.com/articles/gganimate.html